
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>权限管理</title>
<#--    <%@include file="/WEB-INF/views/common/link.jsp"%>-->
    <#include "../common/link.ftl">
    <script src="/js/plugins/messager/jquery.bootstrap.min.js"></script>
    <script src="js/jquery/jquery.min.js"></script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
  <#--  <%@include file="/WEB-INF/views/common/navbar.jsp"%>-->
    <#include "../common/navbar.ftl">
    <!--菜单回显-->
    <<#--c:set var="currentMenu" value="permission"/>-->
      <#assign currentMenu="permission">
   <#-- <%@include file="/WEB-INF/views/common/menu.jsp"%>-->
      <#include "../common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>权限管理</h1>
        </section>
        <section class="content">
            <div class="box" >
                <!--高级查询--->
                <form class="form-inline" id="searchForm" action="/permission/list.do" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">
                    <a href="javascript:;" class="btn btn-success btn_reload" style="margin: 10px;">
                        <span class="glyphicon glyphicon-repeat"></span>  重新加载
                    </a>
                </form>
                <script>
                    $(function () {
                        $(".btn_reload").click(function () {
                           //点击重新加载
                           //局部刷新
                            $.messager.model = {
                                ok: {text: '确认'},
                                cancel: {text: '取消'}
                            }
                            //确认框
                            $.messager.confirm('警告', '耗时长,确认重新加载?', function () {
                                $.get("/permission/reload.do",function (date) {
                                    if (date.success){
                                        $.messager.popup("刷新成功,两秒后自动刷新");
                                        setTimeout(function () {
                                            window.location.reload();
                                        },2000);
                                    }
                                })
                            })
                        });
                    })
                </script>
                <table class="table table-striped table-hover" >
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>权限名称</th>
                        <th>权限表达式</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                     <#list pageResult.list as permission>
                    <#--<c:forEach items="${result.date}" var="permission" varStatus="vs">-->
                       <tr>
                           <td>${permission_index+1}</td>
                           <td>${permission.name!}</td>
                           <td>${permission.expression!}</td>
                           <td>
                               <a href="#" class="btn btn-danger btn-xs btn_delete"
                               data-xxx="${permission.id!}"
                               >
                                   <span class="glyphicon glyphicon-trash"></span> 删除
                               </a>
                           </td>
                       </tr>
                     </#list>
                    </table>
                <script>
                    $(".btn_delete").click(function () {

                        var $xxx = $(this).data("xxx");
                        $.messager.model = {
                            ok: {text: '确认'},
                            cancel: {text: '取消'}
                        }
                        //确认框
                        $.messager.confirm('警告', '数据将被删除!', function () {
                            //点击确定后的回调函数  
                            $.get("/permission/delete.do","id="+$xxx,function (date) {
                                if (date.success){
                                    $.messager.popup("删除成功,两秒后自动刷新");
                                    setTimeout(function () {
                                        window.location.reload();
                                    },2000);
                                }else {

                                    $.messager.popup("删除失败");
                                }
                            })
                        });
                    });
                </script>
                <!--分页-->
               <#-- <%@include file="/WEB-INF/views/common/page.jsp"%>-->
                <#include "../common/page.ftl">
            </div>
        </section>
    </div>
 <#--   <%@include file="/WEB-INF/views/common/footer.jsp"%>-->
    <#include "../common/footer.ftl">
</div>
</body>
</html>
